package com.hexacta.hrs.test.data;

import java.util.List;
import java.util.Map;

import org.springframework.transaction.annotation.Transactional;

/**
 * TestDataCreator decorator. This class is used to add transactional behavior
 * to a TestDataCreator (see the Spring XML).
 * 
 * @author tpollak
 */
public class TransactionalTestDataCreatorDecorator implements TestDataCreator {

    private final TestDataCreator decorated;

    public TransactionalTestDataCreatorDecorator(TestDataCreator decorated) {
        this.decorated = decorated;
    }

    @Transactional
    public Object createTestData(Map<String, Object> context) {
        return this.getDecorated().createTestData(context);
    }

    public List<TestDataDependencyCreator> getDependencies() {
        return this.getDecorated().getDependencies();
    }

    /**
     * @return the decorated
     */
    public final TestDataCreator getDecorated() {
        return this.decorated;
    }

}
